{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Search pubmed and save results\n",
    "\n",
    "This example demonstrates the typical workflow to query pubmed and store\n",
    "the results. The following backends are supported for storing the results:\n",
    "\n",
    "* [MySQL](#MySQL)\n",
    "* [SQLite](#SQLite)\n",
    "* [Citation (endnote/bibtex)](#citations)\n",
    "\n",
    "Authors: Isabel Restrepo <br>\n",
    "BCBI - Brown University <br>\n",
    "Version: Julia 0.6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "WARNING: Method definition ==(Base.Nullable{S}, Base.Nullable{T}) in module Base at nullable.jl:238 overwritten in module NullableArrays at /Users/isa/.julia/v0.6/NullableArrays/src/operators.jl:99.\n"
     ]
    }
   ],
   "source": [
    "using BioMedQuery.Processes\n",
    "using BioMedQuery.PubMed"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "email= \"\" #Only needed if you want to contact NCBI with inqueries\n",
    "search_term=\"(obesity[MeSH Major Topic]) AND (\\\"2010\\\"[Date - Publication] : \\\"2012\\\"[Date - Publication])\"\n",
    "max_articles = 5\n",
    "results_dir = \"./results\"\n",
    "verbose = false;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<a id='MySQL'></a>\n",
    "## MySQL backend"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Getting 5 articles, starting at index 0\n",
      "------ESearch--------\n",
      "------EFetch--------\n",
      "------Save to database--------\n",
      "Initializing MySQL Database\n",
      "Set to overwrite MySQL database pubmed_obesity_2010_2012\n",
      "Database pubmed_obesity_2010_2012 created and initialized\n",
      "Saving 5 articles to database\n",
      "Finished searching, total number of articles: 5\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "MySQL Handle\n",
       "------------\n",
       "Host: localhost\n",
       "User: root\n",
       "DB:   pubmed_obesity_2010_2012\n"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mysql_config = Dict(:host=>\"127.0.0.1\",\n",
    "                    :dbname=>\"pubmed_obesity_2010_2012\",\n",
    "                    :username=>\"root\",\n",
    "                    :pswd=>\"\",\n",
    "                    :overwrite=>true)\n",
    "db_mysql = pubmed_search_and_save(email, search_term, max_articles,\n",
    "    save_efetch_mysql, mysql_config, verbose)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Access all PMIDS"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5-element DataArrays.DataArray{Int32,1}:\n",
       " 24315250\n",
       " 24444198\n",
       " 24533500\n",
       " 24694474\n",
       " 25548090"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "display(all_pmids(db_mysql))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Explore tables\n",
    "\n",
    "* You may use the MySQL command directly or you can use BioMedQuery.DBUtils for a common interface to MySQL/SQLite"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5×3 DataFrames.DataFrame\n",
      "│ Row │ id │ forename            │ lastname          │\n",
      "├─────┼────┼─────────────────────┼───────────────────┤\n",
      "│ 1   │ 31 │ \"A\"                 │ \"Carbonell-Baeza\" │\n",
      "│ 2   │ 26 │ \"Alexandre Paulino\" │ \"de Faria\"        │\n",
      "│ 3   │ 23 │ \"Andrea Maculano\"   │ \"Esteves\"         │\n",
      "│ 4   │ 32 │ \"C\"                 │ \"Gatto-Cardia\"    │\n",
      "│ 5   │ 24 │ \"Carolina\"          │ \"Ackel-D'Elia\"    │\n",
      "5×2 DataFrames.DataFrame\n",
      "│ Row │ aid │ pmid     │\n",
      "├─────┼─────┼──────────┤\n",
      "│ 1   │ 29  │ 24315250 │\n",
      "│ 2   │ 30  │ 24315250 │\n",
      "│ 3   │ 31  │ 24315250 │\n",
      "│ 4   │ 32  │ 24315250 │\n",
      "│ 5   │ 33  │ 24315250 │\n",
      "5×2 DataFrames.DataFrame\n",
      "│ Row │ id    │ name                   │\n",
      "├─────┼───────┼────────────────────────┤\n",
      "│ 1   │ 328   │ \"Adult\"                │\n",
      "│ 2   │ 17677 │ \"Age Distribution\"     │\n",
      "│ 3   │ 368   │ \"Aged\"                 │\n",
      "│ 4   │ 369   │ \"Aged, 80 and over\"    │\n",
      "│ 5   │ 704   │ \"Analysis of Variance\" │\n",
      "5×2 DataFrames.DataFrame\n",
      "│ Row │ id  │ name            │\n",
      "├─────┼─────┼─────────────────┤\n",
      "│ 1   │ 32  │ \"analysis\"      │\n",
      "│ 2   │ 97  │ \"blood\"         │\n",
      "│ 3   │ 150 │ \"complications\" │\n",
      "│ 4   │ 453 │ \"epidemiology\"  │\n",
      "│ 5   │ 208 │ \"ethnology\"     │\n",
      "5×6 DataFrames.DataFrame\n",
      "│ Row │ id │ pmid     │ did   │ qid │ dmjr │ qmjr │\n",
      "├─────┼────┼──────────┼───────┼─────┼──────┼──────┤\n",
      "│ 1   │ 1  │ 25548090 │ 17677 │ NA  │ NA   │ NA   │\n",
      "│ 2   │ 2  │ 25548090 │ 368   │ NA  │ NA   │ NA   │\n",
      "│ 3   │ 3  │ 25548090 │ 369   │ NA  │ NA   │ NA   │\n",
      "│ 4   │ 4  │ 25548090 │ 5260  │ NA  │ NA   │ NA   │\n",
      "│ 5   │ 5  │ 25548090 │ 6801  │ NA  │ NA   │ NA   │\n"
     ]
    }
   ],
   "source": [
    "tables = [\"author\", \"author2article\", \"mesh_descriptor\",\n",
    "\"mesh_qualifier\", \"mesh_heading\"]\n",
    "\n",
    "for t in tables\n",
    "    query_str = \"SELECT * FROM \"*t*\" LIMIT 5;\"\n",
    "    q = BioMedQuery.DBUtils.db_query(db_mysql, query_str)\n",
    "    println(q)\n",
    "end"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "<a id='SQLite'></a>\n",
    "## SQLite backend"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Getting 5 articles, starting at index 0\n",
      "------ESearch--------\n",
      "------EFetch--------\n",
      "------Save to database--------\n",
      "Initializing SQLite Database\n",
      "Saving 5 articles to database\n",
      "Finished searching, total number of articles: 5\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "SQLite.DB(\"./results/pubmed_obesity_2010_2012.db\")"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sqlite_config = Dict(:db_path=>\"$(results_dir)/pubmed_obesity_2010_2012.db\",\n",
    "              :overwrite=>true)\n",
    "db_sqlite = pubmed_search_and_save(email, search_term, max_articles,\n",
    "    save_efetch_sqlite, sqlite_config, verbose)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Access all PMIDS"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5-element Array{Int64,1}:\n",
       " 24315250\n",
       " 24444198\n",
       " 24533500\n",
       " 24694474\n",
       " 25548090"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "display(all_pmids(db_sqlite))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Explore tables\n",
    "\n",
    "* You may use the SQLite commands directly or you can use BioMedQuery.DBUtils for a common interface to MySQL/SQLite"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5×3 DataFrames.DataFrame\n",
      "│ Row │ id │ forename    │ lastname   │\n",
      "├─────┼────┼─────────────┼────────────┤\n",
      "│ 1   │ 1  │ \"Eun Sun\"   │ \"So\"       │\n",
      "│ 2   │ 2  │ \"Kwang Soo\" │ \"Yoo\"      │\n",
      "│ 3   │ 3  │ \"Masaru\"    │ \"Sakurai\"  │\n",
      "│ 4   │ 4  │ \"Koshi\"     │ \"Nakamura\" │\n",
      "│ 5   │ 5  │ \"Katsuyuki\" │ \"Miura\"    │\n",
      "5×2 DataFrames.DataFrame\n",
      "│ Row │ aid │ pmid     │\n",
      "├─────┼─────┼──────────┤\n",
      "│ 1   │ 1   │ 25548090 │\n",
      "│ 2   │ 2   │ 25548090 │\n",
      "│ 3   │ 3   │ 24694474 │\n",
      "│ 4   │ 4   │ 24694474 │\n",
      "│ 5   │ 5   │ 24694474 │\n",
      "5×2 DataFrames.DataFrame\n",
      "│ Row │ id   │ name                   │\n",
      "├─────┼──────┼────────────────────────┤\n",
      "│ 1   │ 328  │ \"Adult\"                │\n",
      "│ 2   │ 368  │ \"Aged\"                 │\n",
      "│ 3   │ 369  │ \"Aged, 80 and over\"    │\n",
      "│ 4   │ 704  │ \"Analysis of Variance\" │\n",
      "│ 5   │ 1835 │ \"Body Weight\"          │\n",
      "5×2 DataFrames.DataFrame\n",
      "│ Row │ id  │ name            │\n",
      "├─────┼─────┼─────────────────┤\n",
      "│ 1   │ 32  │ \"analysis\"      │\n",
      "│ 2   │ 97  │ \"blood\"         │\n",
      "│ 3   │ 150 │ \"complications\" │\n",
      "│ 4   │ 208 │ \"ethnology\"     │\n",
      "│ 5   │ 209 │ \"etiology\"      │\n",
      "5×6 DataFrames.DataFrame\n",
      "│ Row │ id │ pmid     │ did   │ qid   │ dmjr  │ qmjr  │\n",
      "├─────┼────┼──────────┼───────┼───────┼───────┼───────┤\n",
      "│ 1   │ 1  │ 25548090 │ 17677 │ #NULL │ #NULL │ #NULL │\n",
      "│ 2   │ 2  │ 25548090 │ 368   │ #NULL │ #NULL │ #NULL │\n",
      "│ 3   │ 3  │ 25548090 │ 369   │ #NULL │ #NULL │ #NULL │\n",
      "│ 4   │ 4  │ 25548090 │ 5260  │ #NULL │ #NULL │ #NULL │\n",
      "│ 5   │ 5  │ 25548090 │ 6801  │ #NULL │ #NULL │ #NULL │\n"
     ]
    }
   ],
   "source": [
    "tables = [\"author\", \"author2article\", \"mesh_descriptor\",\n",
    "\"mesh_qualifier\", \"mesh_heading\"]\n",
    "\n",
    "for t in tables\n",
    "    query_str = \"SELECT * FROM \"*t*\" LIMIT 5;\"\n",
    "    q = BioMedQuery.DBUtils.db_query(db_sqlite, query_str)\n",
    "    println(q)\n",
    "end"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "<a id='citations'></a>\n",
    "\n",
    "## Citations\n",
    "\n",
    "* Citation type can be \"endnote\" or \"bibtex\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Getting 5 articles, starting at index 0\n",
      "------ESearch--------\n",
      "------EFetch--------\n",
      "------Save to database--------\n",
      "Saving citation for 5 articles\n",
      "Finished searching, total number of articles: 5\n"
     ]
    }
   ],
   "source": [
    "enw_file = \"$(results_dir)/pubmed_obesity_2010_2012.enw\"\n",
    "endnote_config = Dict(:type => \"endnote\", \n",
    "                      :output_file => enw_file, \n",
    "                      :overwrite=> true)\n",
    "pubmed_search_and_save(email, search_term, max_articles,\n",
    "    save_article_citations, endnote_config, verbose);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "%0 Journal Article\n",
      "%A So, ES\n",
      "%A Yoo, KS\n",
      "%D 2012\n",
      "%T Waist circumference cutoff points for central obesity in the Korean elderly population.\n",
      "%J J Appl Gerontol\n",
      "%V 34\n",
      "%N 1\n",
      "%P 102-17\n",
      "%M 25548090\n",
      "%U http://www.ncbi.nlm.nih.gov/pubmed/25548090\n",
      "%X The aim is to determine the appropriate cutoff values of waist circumference (WC) for an increased risk of the metabolic syndrome in the Korean elderly population. We analyzed the WC cutoff values of four groups divided according to sex and age with a total of 2,224 elderly participants aged 65 years old and above from the Fourth Korean National Health and Nutrition Examination Survey using the receiver operating characteristic curve and multiple logistic regression. The WC cutoff values associated with an increased risk of metabolic syndrome were 89.6 cm for men and 90.5 cm for women for those who were 65 to 74 years old, and 89.9 cm for men and 87.9 cm for women for those who were 75 years old or older. WC cutoff points for estimating metabolic risk are similar in elderly men and women. Age-specific optimal WC cutoff points should be considered especially for elderly women in screening for metabolic syndrome.\n",
      "%K Age Distribution\n",
      "%K Aged\n",
      "%K Aged, 80 and over\n",
      "%K Female\n",
      "%K Humans\n",
      "%K Logistic Models\n",
      "%K Male\n",
      "%K Metabolic Syndrome\n",
      "%K Nutrition Surveys\n",
      "%K Obesity, Abdominal\n",
      "%K ROC Curve\n",
      "%K Republic of Korea\n",
      "%K Risk Factors\n",
      "%K Sex Distribution\n",
      "%K Waist Circumference\n",
      "%+ Chonbuk National University, South Korea soeunjee@naver.com., Chonbuk National University, South Korea.\n",
      "\n",
      "%0 Journal Article\n",
      "%A Sakurai, M\n",
      "%A Nakamura, K\n",
      "%A Miura, K\n",
      "%A Yoshita, K\n",
      "%A Takamura, T\n",
      "%A Nagasawa, SY\n",
      "%A Morikawa, Y\n",
      "%A Ishizaki, M\n",
      "%A Kido, T\n",
      "%A Naruse, Y\n",
      "%A Nakashima, M\n",
      "%A Nogawa, K\n",
      "%A Suwazono, Y\n",
      "%A Nakagawa, H\n",
      "%D 2012\n",
      "%T Association between a serum thyroid-stimulating hormone concentration within the normal range and indices of obesity in Japanese men and women.\n",
      "%J Intern. Med.\n",
      "%V 53\n",
      "%N 7\n",
      "%P 669-74\n",
      "%M 24694474\n",
      "%U http://www.ncbi.nlm.nih.gov/pubmed/24694474\n",
      "%X OBJECTIVE: This cross-sectional study investigated the associations between the serum thyroid-stimulating hormone (TSH) concentration and indices of obesity in middle-aged Japanese men and women. METHODS: The participants were 2,037 employees (1,044 men and 993 women; age, 36-55 yr) of a metal products factory in Japan. Clinical examinations were conducted in 2009. We obtained a medical history and anthropometric measurements (body weight, body mass index [BMI] and waist circumference) and measured the serum TSH concentrations. The anthropometric indices were compared across serum TSH quartiles. The associations were evaluated separately according to the smoking status in men. RESULTS: The mean body weight (kg), BMI (kg/m(2)) and waist circumference (cm) were 69.2, 23.7 and 83.2 in men and 55.3, 22.3 and 74.3 in women, respectively. Men with a higher TSH concentration had higher body weight and BMI values (p for trend=0.016 and 0.019, respectively), and these significant associations were observed even after adjusting for age, smoking status and other potential confounders. The TSH level was not associated with waist circumference. We found a significant interaction between the TSH level and the smoking status on body weight (p for interaction=0.013) and a significant association between the TSH level and body weight in nonsmokers, but not in current smokers. No significant associations were observed between the TSH level and the anthropometric indices in women. CONCLUSION: Significant positive associations between the serum TSH concentration, body weight and BMI were detected in men only, and an interaction with the smoking status was observed for this association. \n",
      "%K Adult\n",
      "%K Biomarkers\n",
      "%K Body Mass Index\n",
      "%K Body Weight\n",
      "%K Cross-Sectional Studies\n",
      "%K Female\n",
      "%K Humans\n",
      "%K Incidence\n",
      "%K Japan\n",
      "%K Male\n",
      "%K Middle Aged\n",
      "%K Obesity\n",
      "%K Prevalence\n",
      "%K Prognosis\n",
      "%K Reference Values\n",
      "%K Surveys and Questionnaires\n",
      "%K Thyrotropin\n",
      "%+ Department of Epidemiology and Public Health, Kanazawa Medical University, Japan.\n",
      "\n",
      "%0 Journal Article\n",
      "%A Drenowatz, C\n",
      "%A Kobel, S\n",
      "%A Kettner, S\n",
      "%A Kesztyüs, D\n",
      "%A Steinacker, JM\n",
      "%D 2012\n",
      "%T Interaction of sedentary behaviour, sports participation and fitness with weight status in elementary school children.\n",
      "%J Eur J Sport Sci\n",
      "%V 14\n",
      "%N 1\n",
      "%P 100-5\n",
      "%M 24533500\n",
      "%U http://www.ncbi.nlm.nih.gov/pubmed/24533500\n",
      "%X Even though the effect of single components contributing to weight gain in children have been addressed only limited research is available on the combined association of sports participation, physical fitness and time spent watching TV with body weight in children. Baseline data from 1594 children (809 male; 785 female), 7.1 ± 0.6 years of age participating in a large school-based intervention in southern Germany was used. Height and weight was measured and body mass index (BMI) percentiles (BMIPCT) were determined accordingly. Sports participation and time spent watching TV was assessed via parent questionnaire while fitness was determined via a composite fitness test. Combined and single associations of sports participation, TV time and fitness with BMIPCT and weight status were assessed via ANCOVA as well as logistic regression analysis, controlling for age and sex. A significant interaction of TV time, sports participation and fitness on BMIPCT occurred, despite low correlations among the three components. Further, there was a combined association of sports participation and TV time on BMIPCT. TV time and fitness were also independently associated with BMIPCT. Similarly, only increased TV time and lower fitness were associated with a higher odds ratio for overweight/obesity. These results underline the complex interaction of TV time, sports participation and fitness with BMIPCT. In children, TV time and fitness have a stronger influence on BMIPCT compared to sports participation. Sports participation, however, may not reflect overall activity levels of children appropriately. More research is necessary to examine the complex interaction of various behaviours and fitness with BMIPCT.\n",
      "%K Analysis of Variance\n",
      "%K Body Mass Index\n",
      "%K Child\n",
      "%K Exercise\n",
      "%K Female\n",
      "%K Germany\n",
      "%K Humans\n",
      "%K Logistic Models\n",
      "%K Male\n",
      "%K Odds Ratio\n",
      "%K Overweight\n",
      "%K Pediatric Obesity\n",
      "%K Physical Fitness\n",
      "%K Sedentary Lifestyle\n",
      "%K Sports\n",
      "%K Surveys and Questionnaires\n",
      "%K Television\n",
      "%K Weight Gain\n",
      "%+ a Division of Sport and Rehabilitation Medicine , Ulm University Medical Center , Ulm , Germany.\n",
      "\n",
      "%0 Journal Article\n",
      "%A Cavagnolli, DA\n",
      "%A Esteves, AM\n",
      "%A Ackel-D'Elia, C\n",
      "%A Maeda, MY\n",
      "%A de Faria, AP\n",
      "%A Tufik, S\n",
      "%A de Mello, MT\n",
      "%D 2012\n",
      "%T Aerobic exercise does not change C-reactive protein levels in non-obese patients with obstructive sleep apnoea.\n",
      "%J Eur J Sport Sci\n",
      "%V 14 Suppl 1\n",
      "%P S142-7\n",
      "%M 24444198\n",
      "%U http://www.ncbi.nlm.nih.gov/pubmed/24444198\n",
      "%X The aim of this study is to evaluate the effects of a 2-month aerobic exercise training programme on C-reactive protein (CRP) levels in non-obese patients with obstructive sleep apnoea. Twenty non-obese and sedentary adult male volunteers underwent polysomnography (PSG) to assess their sleep parameters. After the PSG analysis, the subjects were divided into two groups (CTRL, control and OSA, obstructive sleep apnoea). Twenty-four sessions of aerobic exercise were performed, and PSG was repeated on the night that followed the last physical training session (24th). Blood samples were collected for CRP analysis before the first exercise session and after the last session. The OSA group demonstrated a reduction in sleep latency (SL) after 2 months of physical exercise, and 80% of them showed a lower apnoea-hypopnoea index (AHI), although this difference was not statistically significant. The differences between the CRP values for the CTRL and OSA groups were also not statistically significant at baseline or after 2 months of physical exercise. Furthermore, there was no correlation between the CRP levels and body mass index (BMI) in the two groups assessed. Our results suggest that in non-obese patients with OSA, CRP levels were normal and did not change after 2 months of aerobic exercise training.\n",
      "%K Adult\n",
      "%K C-Reactive Protein\n",
      "%K Case-Control Studies\n",
      "%K Exercise\n",
      "%K Humans\n",
      "%K Male\n",
      "%K Middle Aged\n",
      "%K Obesity\n",
      "%K Sleep Apnea, Obstructive\n",
      "%K Young Adult\n",
      "%+ a Departamento de Psicobiologia , Universidade Federal de São Paulo , São Paulo , Brazil.\n",
      "\n",
      "%0 Journal Article\n",
      "%A Aparicio, VA\n",
      "%A Ortega, FB\n",
      "%A Carbonell-Baeza, A\n",
      "%A Gatto-Cardia, C\n",
      "%A Sjöström, M\n",
      "%A Ruiz, JR\n",
      "%A Delgado-Fernández, M\n",
      "%D 2011\n",
      "%T Fibromyalgia's key symptoms in normal-weight, overweight, and obese female patients.\n",
      "%J Pain Manag Nurs\n",
      "%V 14\n",
      "%N 4\n",
      "%P 268-76\n",
      "%M 24315250\n",
      "%U http://www.ncbi.nlm.nih.gov/pubmed/24315250\n",
      "%X Factors affecting the symptomatology of fibromyalgia (FM) are not fully understood. The aim of the present study was to analyze the relationship of weight status with pain, fatigue, and stiffness in Spanish female FM patients, with special focus on the differences between overweight and obese patients. The sample comprised 177 Spanish women with FM (51.3 ± 7.3 years old). We assessed tenderness (using pressure algometry), pain and vitality using the General Health Short-Form Survey (SF36), and pain, fatigue, morning tiredness, and stiffness using the Fibromyalgia Impact Questionnaire (FIQ). The international criteria for body mass index was used to classify the patients as normal weight, overweight, or obese. Thirty-two percent were normal-weight, 35% overweight, and 32% obese. Both overweight and obese patients had higher levels of pain than normal-weight patients, as assessed by FIQ and SF36 questionnaires and tender point count (p < .01). The same pattern was observed for algometer score, yet the differences were not significant. Both overweight and obese patients had higher levels of fatigue, and morning tiredness, and stiffness (p < .05) and less vitality than normal-weight patients. No significant differences were observed in any of the variables studied between overweight and obese patients. In conclusion, FM symptomatology in obese patients did not differ from overweight patients, whereas normal-weight patients significantly differed from overweight and obese patients in the studied symptoms. These findings suggest that keeping a healthy (normal) weight is not only associated with decreased risk for developing FM but might also be a relevant and useful way of improving FM symptomatology in women.\n",
      "%K Adult\n",
      "%K Body Mass Index\n",
      "%K Body Weight\n",
      "%K Fatigue\n",
      "%K Female\n",
      "%K Fibromyalgia\n",
      "%K Health Status\n",
      "%K Humans\n",
      "%K Middle Aged\n",
      "%K Obesity\n",
      "%K Overweight\n",
      "%K Pain\n",
      "%K Pain Measurement\n",
      "%K Quality of Life\n",
      "%K Severity of Illness Index\n",
      "%K Surveys and Questionnaires\n",
      "%+ Department of Physical Education and Sport, School of Physical Activity and Sports Sciences, University of Granada, Granada, Spain; Department of Biosciences and Nutrition, Unit for Preventive Nutrition, Novum, Karolinska Institutet, Stockholm Sweden; Department of Physiology and Institute of Nutrition and Food Technology, University of Granada, Granada, Spain. Electronic address: virginiaparicio@ugr.es.\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "println(readstring(enw_file))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Julia 0.6.0",
   "language": "julia",
   "name": "julia-0.6"
  },
  "language_info": {
   "file_extension": ".jl",
   "mimetype": "application/julia",
   "name": "julia",
   "version": "0.6.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
